package com.ruoyi.fly.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.fly.domain.Feedback;
import com.ruoyi.fly.domain.vo.BatchDeleteVO;
import com.ruoyi.fly.service.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/feedback")
@Api(tags = "反馈管理")
public class FeedbackController extends BaseController {

    @Autowired
    private FeedbackService feedbackService;


    /**
     * 查询反馈管理列表
     */
    @ApiOperation(value = "查询反馈管理列表")
    @PostMapping("/selList")
    public TableDataInfo list(Feedback feedback) {
        startPage();
        List<Feedback> list = feedbackService.selectFeedbackList(feedback);
        return getDataTable(list);
    }

    /**
     * 根据反馈id获取反馈详细信息
     */
    @ApiOperation(value = "根据反馈id获取反馈详细信息")
    @GetMapping(value = "/selId/{id}")
    public R getInfo(@PathVariable("id") String id) {
        return R.ok(feedbackService.selectFeedbackById(id));
    }


    /**
     * 删除反馈
     */
    @ApiOperation(value = "删除反馈")
    @PostMapping("/delete")
    public R remove(@RequestBody BatchDeleteVO ids) {
        return feedbackService.deleteFeedbackByIds(ids.getIds());
    }
}
